package com.itboye.hutouben.presenter;

import com.itboye.hutouben.responsitory.GoodsResponsitory;
import com.itboye.hutouben.volley.ICompleteListener;
import com.itboye.hutouben.volley.ResultEntity;

import java.util.Observer;

/**
 * Created by boye009 on 2016/12/6.
 */

public class GoodsPresenter extends BasePresenter {
    public GoodsPresenter(Observer observer) {
        super(observer);
    }

    public static final String Detail_success = GoodsPresenter.class.getName()
            + "_Detail_success";
    public static final String Detail_fail = GoodsPresenter.class.getName()
            + "_Detail_fail";

    public void detailInfo(String pid) {
        GoodsResponsitory detail = new GoodsResponsitory(new ICompleteListener() {
            @Override
            public void success(ResultEntity result) {
                result.setEventTag(Tag_Success);
                result.setEventType(Detail_success);
                setChanged();
                notifyObservers(result);
            }

            @Override
            public void failure(ResultEntity result) {
                result.setEventTag(Tag_Error);
                result.setEventType(Detail_fail);
                setChanged();
                notifyObservers(result);
            }
        });
        detail.detailInfo(pid);
    }

}